from .web_element import WebElement


class InputTag(WebElement):
    '''
    input元素操作
    '''

    def get_multiple(self):
        '''
        获取网页元素的multiple属性值

        :Returns:
            返回网页元素的multiple属性值
        '''
        return self.control.GetMultiple

    def set_multiple(self, multiple):
        '''
        设置网页元素的multiple属性值

        :Args:
         - multiple: 网页元素的multiple属性值
        '''
        self.control.SetMultiple(multiple)

    def get_name(self):
        '''
        获取网页元素的name属性值

        :Returns:
            返回网页元素的name属性值
        '''
        return self.control.GetName

    def set_name(self, name):
        '''
        设置网页元素的name属性值

        :Args:
         - name: 网页元素的name属性值
        '''
        self.control.SetName(name)

    def get_pattern(self):
        '''
        获取网页元素的pattern属性值

        :Returns:
            返回网页元素的pattern属性值
        '''
        return self.control.GetPattern

    def set_pattern(self, pattern):
        '''
        设置网页元素的pattern属性值

        :Args:
         - pattern: 网页元素的pattern属性值
        '''
        self.control.SetPattern(pattern)

    def get_placeholder(self):
        '''
        获取网页元素的placeholder属性值

        :Returns:
            返回网页元素的placeholder属性值
        '''
        return self.control.GetPlaceholder

    def set_placeholder(self, placeholder):
        '''
        设置网页元素的placeholder属性值

        :Args:
         - placeholder: 网页元素的placeholder属性值
        '''
        self.control.SetPlaceholder(placeholder)

    def get_title(self):
        '''
        获取网页元素的title属性值

        :Returns:
            返回网页元素的title属性值
        '''
        return self.control.GetTitle

    def set_title(self, title):
        '''
        设置网页元素的title属性值

        :Args:
         - title: 网页元素的title属性值
        '''
        self.control.SetTitle(title)

    def get_input_type(self):
        '''
        获取网页元素的type属性值

        :Returns:
            返回网页元素的type属性值
        '''
        return self.control.GetInputType

    def set_input_type(self, type):
        '''
        设置网页元素的type属性值

        :Args:
         - type: 网页元素的type属性值
        '''
        self.control.SetInputType(type)

    def get_value(self):
        '''
        获取网页元素的value属性值

        :Returns:
            返回网页元素的value属性值
        '''
        return self.control.GetValue

    def set_value(self, value):
        '''
        设置网页元素的value属性值

        :Args:
         - value: 网页元素的value属性值
        '''
        self.control.SetValue(value)

    def get_checked(self):
        '''
        获取网页元素的checked属性值

        :Returns:
            返回网页元素的checked属性值
        '''
        return self.control.GetChecked

    def set_checked(self, checked):
        '''
        设置网页元素的checked属性值

        :Args:
         - checked: 网页元素的checked属性值
        '''
        self.control.SetChecked(checked)

    def get_auto_focus(self):
        '''
        获取网页元素的autofocus属性值

        :Returns:
            返回网页元素的autofocus属性值
        '''
        return self.control.GetAutoFocus

    def set_auto_focus(self, auto_focus):
        '''
        设置网页元素的autofocus属性值

        :Args:
         - auto_focus: 网页元素的autofocus属性值
        '''
        self.control.SetAutoFocus(auto_focus)

    def get_auto_complete(self):
        '''
        获取网页元素的autocomplete属性值

        :Returns:
            返回网页元素的autocomplete属性值
        '''
        return self.control.GetAutoComplete

    def set_auto_complete(self, auto_complete):
        '''
        设置网页元素的autocomplete属性值

        :Args:
         - auto_complete: 网页元素的autocomplete属性值
        '''
        self.control.SetAutoComplete(auto_complete)

    def get_size(self):
        '''
        获取网页元素的size属性值

        :Returns:
            返回网页元素的size属性值
        '''
        return self.control.GetSize

    def set_size(self, size):
        '''
        设置网页元素的size属性值

        :Args:
         - size: 网页元素的size属性值
        '''
        self.control.SetSize(size)

    def get_height(self):
        '''
        获取网页元素的height属性值

        :Returns:
            返回网页元素的height属性值
        '''
        return self.control.GetHeight

    def set_height(self, height):
        '''
        设置网页元素的height属性值

        :Args:
         - height: 网页元素的height属性值
        '''
        self.control.set_height(height)

    def get_width(self):
        '''
        获取网页元素的width属性值

        :Returns:
            返回网页元素的width属性值
        '''
        return self.control.GetWidth

    def set_width(self, width):
        '''
        设置网页元素的width属性值

        :Args:
         - width: 网页元素的width属性值
        '''
        self.control.SetWidth(width)

    def get_disabled(self):
        '''
        获取元素的disabled属性值

        :Returns:
            返回元素的disabled属性值
        '''
        return self.control.GetDisabled

    def set_disabled(self, disabled):
        '''
        设置元素的disabled属性值

        :Args:
         - disabled: 元素的disabled属性值
        '''
        self.control.SetDisabled(disabled)

    def get_attribute(self, name):
        '''
        获取属性值

        :Args:
         - name: 属性名称

        :Returns:
            返回属性值
        '''
        if name == 'class':
            return self.get_css_class()
        elif name == 'id':
            return self.get_id()
        elif name == 'multiple':
            return self.get_multiple()
        elif name == 'name':
            return self.get_name()
        elif name == 'pattern':
            return self.get_pattern()
        elif name == 'placeholder':
            return self.get_placeholder()
        elif name == 'title':
            return self.get_title()
        elif name == 'type':
            return self.get_input_type()
        elif name == 'value':
            return self.get_value()
        elif name == 'checked':
            return self.get_checked()
        elif name == 'autofocus':
            return self.get_auto_focus()
        elif name == 'autocomplete':
            return self.get_auto_complete()
        elif name == 'size':
            return self.get_size()
        elif name == 'height':
            return self.get_height()
        elif name == 'width':
            return self.get_width()
        elif name == 'disabled':
            return self.get_disabled()
        else:
            return self.get_attribute_value(name)